5CC-FileFormats-PitF(2013)
Date: 2013-01-24
Author: Mafi

File format: *.TXT; 
used by the file: map data files (ASCII, new ID)

Contents of the *.txt files: map data description (map size, map name, map density, map weather, map terrain, map elevation, same file format since CC3. ASCII text files since CC3 are using CR+LF as end-of-line delimiter (Chr(13) + Chr(10)).

Map data file structure since 2012 (*.txt):
- first line: ID, always the string "16", meaning one terrain element has the size 16x16 pixels.
- second line: can contain the map’s name,
- third line: width (in elevation tiles), followed by TAB and a comment,
- forth line: height (in elevation tiles), followed by TAB and a comment,
- fifth line: weather type descriptor, followed by TAB and a comment,
- sixth line: map density (terrain type) descriptor, followed by TAB and a comment,
- seventh line: comment line starting with the string "Idx", followed by TAB + string "E0" + TAB ... + TAB + "E15" + TAB + "Elev",
- eight line: data start indicator "&",
- data lines, number of data lines = width * height (counted in elevation tiles)
- last line: data end indicator "#",

Every data line starts with the index number of the tile defined by this line. The index numbering starts at 0. The tiles are counted sequentally. The index number will be followed by 16 TAB (Chr(9)) separated terrain numbers (possible range 0 – ???, as defined in the base file "Elements") and by 16 TAB (Chr(9)) separated elevation values (values greater than 0).

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


File format: *.BGM
used by the file: background graphics (new: 24-bit binary graphics)

// *.bgm header since 2012
// header size: 16 bytes
// all integers are coded in Little Endian!
Char(4)	MAPS	// 4 bytes: ID (= Signature), always "MAPS" for 24-bit grpahics, 
		// other values will cause the editor to switch to 16-bit graphics.
Long	iiii	// 4 bytes: image data-size counted in bytes.
Long	xxxx	// 4 bytes: image width in pixels.
Long	yyyy	// 4 bytes: image height in lines.
// graphics data
// data-size = width * height * 3 bytes
data		// each pixel occupies 3 bytes,
		// pixel-byte sequence is: Red, Green, Blue.

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


File format: *.OVM
used by the file: overview graphics (new: 24-bit binary graphics)

// *.ovm header since 2012
// header size: 16 bytes
// all integers are coded in Little Endian!
Char(4)	OVMS	// 4 bytes: ID (= Signature), always "OVMS" for 24-bit grpahics, 
		// other values will cause the editor to switch to 16-bit graphics.
Long	iiii	// 4 bytes: image data-size counted in bytes.
Long	xxxx	// 4 bytes: image width in pixels.
Long	yyyy	// 4 bytes: image height in lines.
// graphics data
// data-size = width * height * 3 bytes
data		// each pixel occupies 3 bytes,
		// pixel-byte sequence is: Red, Green, Blue.

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


File format: *.MMM
used by the file: minimap/monitoring-map graphics (new: 24-bit binary graphics)

// *.mmm header since 2012
// header size: 16 bytes
// all integers are coded in Little Endian!
Char(4)	MMMS	// 4 bytes: ID (= Signature), always "MMMS" for 24-bit grpahics, 
		// other values will cause the editor to switch to 16-bit graphics.
Long	iiii	// 4 bytes: image data-size counted in bytes.
Long	xxxx	// 4 bytes: image width in pixels.
Long	yyyy	// 4 bytes: image height in lines.
// graphics data
// data-size = width * height * 3 bytes
data		// each pixel occupies 3 bytes,
		// pixel-byte sequence is: Red, Green, Blue.

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


File format: *.RFM
used by the file: roof-file graphics (new: 24-bit binary graphics)

// *.rfm header of roof-files since 2012 
// header size = (16 + (132 * roof-pairs)) bytes
// all integers are coded in Little Endian!
Char(4)	RFMS	// 4 bytes: ID (= Signature), always "RFMS" for 24-bit grpahics, 
		// other values will cause the editor to switch to 16-bit graphics.
Long	iiii	// 4 bytes: number of entries (number of roof-pairs)
Long	00000000h	// 4 bytes of unknown purpose, always 0 00000000h
Long	00000000h	// 4 bytes of unknown purpose, always 0 00000000h
for ( each roofpair )	// 132 bytes for each roof pair
	Long 00000002h	// number of roof images for this entry, usually 2
	Long iiii	// number_of_vertices, maximum is 12
	// vertices table, fixed size of 12 entries
	for ( i = 0 ; i < number_of_vertices ; i++ )
		{ 
		Long	vertex.i.x-coordinate
		Long	vertex.i.y-coordinate
		}
	for ( i = number of vertices ; i < 12 ; i++ )
		{
		// CDCDCDCDhex indicates this vertex is not used
		Long	CDCDCDCDh
		Long	CDCDCDCDh
		}
	// coordinates of surrounding rectangle
	Long	iiii	// 3*roof_width = size of pixel line in bytes
	Long	xxxx	// roof_top_left_x-coordinate
	Long	yyyy	// roof_top_left_y-coordinate
	Long	xxxx	// roof_bottom_right_x-coordinate
	Long	yyyy	// roof_bottom_right_y-coordinate
	Long	eeee	// offset_of_exterior_data from beginning of file
	Long	iiii	// offset_of_interior_data from beginning of file
// data section
// new CC format of graphical data, 24-bit color-depth
// each pixel occupies 3 bytes,
// pixel-byte sequence is: Red, Green, Blue.
data
roof0_exterior_data
roof0_interior_data
roof1_exterior_data
roof1_interior_data
roof2_exterior_data
roof2_interior_data
etc.


